<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html>
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>系统界面</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico">
<link href="${contextPath}css/bootstrap.css" rel="stylesheet">
<link href="${contextPath}css/style.css" rel="stylesheet">
<link href="${contextPath}css/animate.min.css" rel="stylesheet">
<link href="${contextPath}css/animate.delay.css" rel="stylesheet">
<link href="${contextPath}css/font-awesome.min.css" rel="stylesheet">
<link href="${contextPath}css/colorbox.css" rel="stylesheet">
<link href="${contextPath}css/fullcalendar.css" rel="stylesheet">
<link href="${contextPath}css/fullcalendar.print.css" rel="stylesheet" media="print">
<link href="${contextPath}css/basic.css" rel="stylesheet">
<link href="${contextPath}css/zebra_dialog.css" rel="stylesheet">
<link href="${contextPath}css/ir_black.css" rel="stylesheet">
<link href="${contextPath}css/newtree/treestyle.css" rel="stylesheet">
<link href="${contextPath}css/newtree/treebootstrap.css" rel="stylesheet">

<link rel="Stylesheet" href="${contextPath}js/My97DatePicker/skin/default/datepicker.css" type="text/css" />
<link rel="Stylesheet" href="${contextPath}js/My97DatePicker/skin/whyGreen/datepicker.css" type="text/css" />
<link rel="Stylesheet" href="${contextPath}js/My97DatePicker/skin/WdatePicker.css" type="text/css" />


<link href="${contextPath}css/jquery.autocomplete.css" rel="stylesheet">

<!--[if IE 7]>
<link href="${contextPath}css/font-awesome-ie7.min.css" rel="stylesheet">
<![endif]-->
</head>

<body>
	<div id="header-container">
		<div id="header">
			<div class="logo">恒盛管理系统 v2.0</div>
			<div class="header-right">
				<div class="header-btn">
					<ul>
						<li><a href="javascript:;"><i class="icon-group"></i>${cu_realName} 管理员 欢迎登录！</a></li>
						<!-- <li class="dropdown notification"><a href="javascript:sys_load_handle('annCollect');"><i class="icon-th"></i> 公告 </a></li> -->
						<li class="dropdown notification">
							<a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">
								<i class="icon-envelope"></i> 消息 <span class="message" id="messageTotalSpan">0</span></a>
							<ul id="messageListUl" class="dropdown-menu"></ul></li>
						<li class="dropdown userinfo">
							<a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="/page.html"> 
								<i class="icon-cog"></i> 管理</a>
							<ul class="dropdown-menu">
								<li><a href="javascript:;" onclick="javascript:sys_load_handle('user-editSelf');"><span class="icon-user"></span> 个人资料</a></li>
								<li><a href="javascript:;" onclick="javascript:sys_load_handle('organOrgan');"><span class="icon-cog"></span> 机构设置</a></li>
								<li><a href="index.html"><span class="icon-signout"></span> 退出系统</a></li>
							</ul></li>
						<li><a href="index.html"><i class="icon-signout"></i> 退出</a></li>
						<li><a href="main.html"><i class="icon-signout"></i> 刷新</a></li>
						<li class="dropdown notification">
							<a href="main.html" data-toggle="dropdown" data-target="#"><i class="icon-retweet"></i>系统切换</a>
							<ul class="dropdown-menu">
								<#list sysList as sys>
									<#if sys.code != 'sys_basic'>
									<li>
										<a href="javascript:;" onclick="javascript:sysChange('${(sys.code)!''}');"><span>${(sys.name)!''}</span></a>
									</li>
									</#if>
								</#list>
							</ul>
						</li>
					</ul>
				</div>
				<div class="header-path">
					<div class="header-full">
						<a class="showmenu" href="#" title="全屏">
							<i class="icon-fullscreen"></i> 全屏</a></div>
					<div id="bread_crumbs_menu_div"><a href="#"><i class="icon-home"></i> 首页 </a><i class="icon-angle-right"></i> 我的控制台</div>
				</div>
			</div>
		</div>
	</div>

	<div id="main-container">
		<div class="contentinner content-dashboard">
			<div id="main-sidebar" class="sidebar" style="overflow: auto;">
				<ul id="mainSideMenu" class="nav-side" style="margin-bottom:20px;">
					<li class="accordion-group">
						<div id="sys_my_contr_div" class="accordion-heading active">
							<a href="#" onclick="javascript: location.reload(); sys_load_default();" data-parent="#mainSideMenu" data-toggle="collapse" class="accordion-toggle">
								<span class="item-icon icon-home"></span><i class="chevron icon-angle-right"></i> 我的控制台
							</a>
						</div>
					</li>
					
					<#list list as sys>
					<#list sys.moduleList as mo>
					<#if ('admin@ish365.com' == cu_email) || (cu_isManager && (orgHandleMap[mo.code])??) || ((handleMap[mo.code])?? && (orgHandleMap[mo.code])??)>
					<li class="accordion-group">
						<div id="sys_mo_div_${mo.code}" class="accordion-heading">
							<a href="#ul_${mo.code}" data-parent="#mainSideMenu" data-toggle="collapse" class="accordion-toggle">
								<span class="item-icon ${(mo.icon)!''}"></span><i class="chevron icon-angle-right"></i> ${mo.name}
							</a>
						</div>
						<ul class="accordion-content nav nav-list collapse" id="ul_${mo.code}">
							<#list mo.menuList as me>
							<#if ('admin@ish365.com' == cu_email) || (cu_isManager && (orgHandleMap[me.code])??) || ((handleMap[me.code])?? && (orgHandleMap[me.code])??)>
							<li id="sys_me_li_${me.code}">
								<a href="javascript:;" onclick="javascript:sys_load_handle('${me.code}', $(this));" id="${me.code}-a" mecode="${me.code}" mocode="${mo.code}" moname="${mo.name}" mename="${me.name}" moicon="${mo.icon}" meicon="${me.icon}">
									<i class="icon-caret-right"></i> ${me.name} </a></li>
							</#if>
							</#list>
						</ul>
					</li>
					</#if>
					</#list>
					</#list>
				</ul>
			</div>
			<div id="handle_content" class="main-content container-fluid"></div>
		</div>
	</div>
	<div class="footer">
		<div class="footerleft">恒盛管理系统 v2.0</div>
		<div class="footerright">
			&copy; Ish365.com - <a href="#">关注微博</a> - <a href="#">关注微信</a>
		</div>
	</div>
	<script src="${contextPath}js/jquery-1.11.0.min.js"></script>
	<script src="${contextPath}js/ckeditor/ckeditor.js"></script>
	<script src="${contextPath}js/ckeditor/adapters/jquery.js"></script>
	<script src="${contextPath}js/prettify.js"></script>
	<script src="${contextPath}js/custom.js"></script>
	<script src="${contextPath}js/jquery-migrate-1.1.1.min.js"></script>
	<script src="${contextPath}js/jquery-ui-1.9.2.min.js"></script>
	<script src="${contextPath}js/bootstrap.js"></script>
	<script src="${contextPath}js/colorpicker.js"></script>
	<script src="${contextPath}js/slider.js"></script>
	<script src="${contextPath}js/jquery.alerts.js"></script>
	<script src="${contextPath}js/jquery.uniform.min.js"></script>
	<script src="${contextPath}js/jquery.tagsinput.min.js"></script>
	<script src="${contextPath}js/charCount.js"></script>
	<script src="${contextPath}js/chosen.jquery.min.js"></script>
	<script src="${contextPath}js/forms.js"></script>
	<script src="${contextPath}js/bootstrap-timepicker.min.js"></script>
	<script src="${contextPath}js/jquery.validate.min.js"></script>
	<script src="${contextPath}js/jquery.autogrow-textarea.js"></script>
	<script src="${contextPath}js/jquery.cookie.js"></script>
	<script src="${contextPath}js/jquery.colorbox-min.js"></script>
	<script src="${contextPath}js/media.js"></script>
	<script src="${contextPath}js/jquery.dataTables.min.js"></script>
	<script src="${contextPath}js/basic.js"></script>
	<script src="${contextPath}js/jquery-ui.custom.min.js"></script>
	<script src="${contextPath}js/fullcalendar.min.js"></script>
	<script src="${contextPath}js/zebra_dialog.js"></script>
	<script src="${contextPath}js/zebra_dialog.src.js"></script>
	<script src="${contextPath}js/jquery.jgrowl.js"></script>
	<script src="${contextPath}js/My97DatePicker/lang/zh-cn.js" type="text/javascript"></script>
	<script src="${contextPath}js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script src="${contextPath}js/ajaxupload/ajaxupload.js" type="text/javascript"></script>
	
	<script src="${contextPath}js/tools.js" type="text/javascript"></script>
	<script src="${contextPath}js/jquery-searchkeyword.min.js" type="text/javascript"></script>
	
	<script src="${contextPath}js/jquery.autocomplete.js" type="text/javascript"></script>
	
	<script src="${contextPath}js/photo/jquery.magicScroller.v1.js" type="text/javascript"></script>
	<script src="${contextPath}js/photo/swfobject.js" type="text/javascript"></script>
	
	<script src="${contextPath}js/highcharts.js"></script>
	<script src="${contextPath}js/exporting.js"></script><!--统计图表-->
	<script src="${contextPath}js/aMap/amapUtil.js"></script>
	<script type="text/javascript">
	var sys_is_loading = false; // 是否在加载中
	var sys_context_path = '${contextPath}';
	var sys_referrer = '';

	$(function() {
		$.ajaxSetup({cache:false });
		
		$(window).bind('hashchange', function(e) {
			sys_hash_change();
		});
		
		sys_load_default();
	});
	
	function sys_hash_change() {
		var handle = window.location.hash;
		console.log(handle);
		var index = handle.indexOf('#');
		if (index != -1) {
			handle = handle.substring(index + 1, handle.length);
			index = handle.indexOf('?');
			if (index != -1)
				handle = handle.substring(0, index);

			if (sys_referrer != handle) {
				var btn = $('#' + handle + '-a');
				sys_load_handle(btn.attr('mecode'), btn, false);
				sys_referrer = handle;
			}
		} else {
			var url = '${contextPath}main-default.html?time=' + sys_get_time();
			$('#handle_content').load(url);
			sys_switch_menu($('#user-center-a'), '用户中心', '我的控制台', 'glyphicon-parents'); 
		}
	}
	
	function sys_load_handle(mecode, btn, isHash) {
		if (sys_is_loading) {
			return;
		}
		sys_is_loading = true;
		var handle_content = $('#handle_content');
		handle_content.html('<p style="width:100%; margin-top:100px; text-align:center;"><img src="${contextPath}images/loading/loading3.gif" />&nbsp;页面加载中...</p>');

		var url = create_url(mecode);
		$.ajax({type:'POST', url:url, cache:false,
			success : function(result) {
				handle_content.html(result);
				if (null != btn)
					 sys_switch_menu(btn); 

				sys_is_loading = false;
			},
			error : function(XMLHttpRequest, ajaxOptions, thrownError) {
				sys_is_loading = false;
			}
		});

		if (null == isHash || isHash)
			window.location.hash = '#' + mecode;
			
	}

	function sys_switch_menu(btn) {
		$('#mainSideMenu').find('div').removeClass('active');
		$('#mainSideMenu').find('li').removeClass('active');
	
		$('#sys_mo_div_' + btn.attr('mocode')).addClass('active');
		$('#sys_me_li_' + btn.attr('mecode')).addClass('active');
	
		var html = '<a href="#"><i class="icon-home"></i> ' + btn.attr('moname') + '</a><i class="icon-angle-right"></i> ' + btn.attr('mename');
		$('#bread_crumbs_menu_div').html(html);
	}

	function sys_load_default() {
		var url = '${contextPath}main-loadDefault.html?time=' + sys_get_time();
		$('#handle_content').load(url);
		var html = '<a href="#"><i class="icon-home"></i> 首页 </a><i class="icon-angle-right"></i> 我的控制台';
		$('#bread_crumbs_menu_div').html(html);
	}

	function sys_voice_warning() {
		$('#sys_evideo').remove();
		var str = '<embed id="sys_evideo" src="${contextPath}voice/771.wav" border="0" width="1" height="1" loop="false" />';
		$('#sys_voice_div').html(str);
		return false;
	}

	function sys_voice_message() {
		$('#sys_evideo').remove();
		var str = '<embed id="sys_evideo" src="${contextPath}voice/call.wav" border="0" width="1" height="1" loop="false" />';
		$('#sys_voice_div').html(str);
		return false;
	}

	function sys_session_keep() {
		$('#sys_session_frame').attr('src', '');
		$('#sys_session_frame').attr('src', '${contextPath}session.html?time=' + sys_get_time());
		
		sys_load_message();
	}
	
	function sys_show_message_detail(code) {
		var parm = {'code':code};
		var url = create_url("message-detail");
		$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'1000px', open:true});
	}
	
	function sys_load_message() {
		var url = '${contextPath}main-newest.html?time=' + sys_get_time();
		$.ajax({type:'POST', url:url, dataType:'json', 
			success : function(result) {
				var total = 0;
				var ul = $('#messageListUl');
				ul.html('');
				if (null != result) {
					var html = null;
					$.each(result, function (i) {
					
						html = '<li><a href="javascript:;" onclick="javascript:sys_show_message_detail(\'' + result[i].code + '\');">'
							+ '<span class="icon-envelope"></span> ' + result[i].title
							+ '<small class="muted"> - ' + result[i].ct + '</small></a></li>';
						total ++;
						if(i <= 5){
						ul.append(html);
						}
					});
				}
				$('#messageTotalSpan').html(total);
				ul.append('<li class="viewmore"><a href="javascript:;" onclick="javascript:sys_load_handle(\'message\');">查看更多信息</a></li>');
			},
			error : function(event, XMLHttpRequest, ajaxOptions, thrownError) {
				sys_is_loading = false;
			}
		});
	}

	var sys_session_keep_time = setInterval(sys_session_keep, 6000000);
	
	
	// 选择系统
	function sysChange(mcode) {
		var url = '${contextPath}main-loadMemu.html?id=' + mcode;
		$.ajax({type:'POST', url:url, dataType:'html',
			success:function(result) {
				var first = $($('#mainSideMenu').children()[0]).clone(true);
				$('#mainSideMenu').empty();
				$('#mainSideMenu').append(first);
				$('#mainSideMenu').append(result);
				sys_load_default();
			},
			error:function () {
				var first = $('#mainSideMenu').children()[0].clone(true);
				$('#mainSideMenu').empty();
				$('#mainSideMenu').append(first);
			}
		});
	}
	</script>
</body>
</html>
